#ifndef _CTRL_H
#define _CTRL_H

#include "../define.h"

class QProcess;
class CtrlThread;

class Ctrl
{
public:
	//static Ctrl& instance();
	static Ctrl* getInstance();

//	result_s *getDataShmPtr() { return dataShmPtr; }
//	bool getMeasState() { return dataShmPtr->isInMeas; }
//	void setMeasState(bool meas) { dataShmPtr->isInMeas = meas; }
	CtrlThread *getCtrlThread() { return ctrlThread; }

	void startCtrlThread();
	void stopCtrlThread();

	void cpyProgramToShm();
	void cpyProgramFromShm();

//	void sem1_p();
//	void sem1_v();
//    void sem2_p();
//	void sem2_v();

	program_s* getProgShmPtr(); // { return progShmPtr; }

private:
	Ctrl();

//	void initMeasEnv();
//	void startProgTest();

/*
	static const char SEM_FILE_PATH[] 		= "//usr";
	static const char PROG_SHM_FILE_PATH[]	= "//bin";
	static const char DATA_SHM_FILE_PATH[]	= "//lib";
	static const int SEM_ITEM_ID		= 123;
	static const int PROG_SHM_ITEM_ID	= 199;
	static const int DATA_SHM_ITEM_ID	= 201;
*/
	static Ctrl* instance;

//	int semId;
//	int progShmId;
//	int dataShmId;

//	program_s	*progShmPtr;
//	result_s	*dataShmPtr;

//	QProcess	*measProcess;
	CtrlThread	*ctrlThread;
};


#endif // _CTRL_H
